<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>打印二维码</title>
		<script type="text/javascript" src="${ctxPath}/assets/common/libs/jquery/jquery-3.2.1.min.js"></script>
		<style type="text/css">
			.gig-div{
				height: 100%;
				width: 800px;
				margin: auto;
			}
			.margin{
				width: 96%;
				height: 100%;
				margin: auto auto 20px auto;
				background-color: #ededee;
			}
			.title-div{
				height: 40%;
				width: 100%;
				text-align: center;
			}
			.top-div-left{
				float: left;
				width: 35%;
				height: 20%;
				text-align: left;
				line-height: 47.5px;
				margin-left: 15px;
				font-weight: 600;
			}
			.top-div-right{
				float: right;
				width: 45%;
				height: 20%;
				text-align: right;
				line-height: 47.5px;
				margin-right: 15px;
				font-weight: 600;
			}
			.bable-div{
				height: 60%;
				width: 100%;
				text-align: center;;
			}
			table{
				border-collapse: collapse;
				text-align: center;
				width: 100%;
				height: 100%;
			}
			table td, table th{
				border: 1.5px solid #666;
				color: #666;
			}
			.bottom-div-left{
				width: 47%;
				height: 40px;
				float: left;
				text-align: left;
				line-height: 40px;
				margin-left: 15px;
			}
			.bottom-div-right{
				width: 40%;
				height: 40px;
				float: right;
				text-align: right;
				line-height: 40px;
				margin-right: 15px;
			}
			.button-div{
				height: 60px;
				width: 650px;
				margin: auto;
				text-align: center;
				line-height: 60px;
			}
			.button-submit{
				display: inline-block;
				height: 38px;
				line-height: 38px;
				padding: 0 18px;
				background-color: #009688;
				color: #fff;
				white-space: nowrap;
				text-align: center;
				font-size: 14px;
				border: none;
				border-radius: 2px;
				cursor: pointer;
			}
			.return{
				border: 1.5px solid #bdbdbd;
				background-color: #fff;
				border-color: #e6e6e6;
				color: #666;
			}
			.title-text{
				font-size: 120px;
				font-weight: 600
			}
			img{
				margin-bottom: 20px;
			}
		</style>
	</head>
	<body>
		<div class="button-div">
			<button class="button-submit" type="button" onclick="printing()">&emsp;Print&emsp;</button>
			<button class="button-submit return" type="button" onclick="backupPage()">&emsp;Close&emsp;</button>
		</div>
		<div class="gig-div" id="printinghtml">
			<!-- <div class="margin">
				<div class="title-div"><span class="title-text">A01</span></div>
				<div class="bable-div">
                    <img id="img">
				</div>
			</div>
			<div class="margin">
				<div class="title-div"><span class="title-text">A01</span></div>
				<div class="bable-div">
                    <img id="img">
				</div>
			</div> -->
		</div>
	</body>
	<script type="text/javascript">
		function getUrlParam(name) {
		    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		    var r = window.location.search.substr(1).match(reg);
		    if (r != null) {
		        return unescape(r[2]);
		    } else {
		        return null;
		    }
		};
		var str = getUrlParam("ids")
		//字符串截取为数组
		var strArr = str.split(",");
		var arr = []
		for(j = 0,len = strArr.length; j < len; j++) {
			arr.push(strArr[j])
		};
		var html = ''
		for (var i=0;i<arr.length;i++){
			html += '<div class="margin">'+
				'<div class="title-div"><span class="title-text">'+arr[i]+'</span></div>'+
				'<div class="bable-div">'+
                    '<img id="img" src="/basicPosition/getqrcode?id='+arr[i]+'">'+
				'</div>'+
			'</div>'
		}
		$("#printinghtml").html(html)
	    //返回按钮
	    function backupPage(){
	    	var Index = parent.layer.getFrameIndex(window.name);
	        parent.layer.close(Index);
	    }

	    //打印按钮
	    function printing(){
	        bdhtml = window.document.body.innerHTML;
	        phtnl = window.document.getElementById("printinghtml").innerHTML;
	        window.document.body.innerHTML = phtnl; //把需要打印的指定内容赋给big
	        window.print(); //调用浏览器的打印功能打印指定区域
	        window.document.body.innerHTML=bdhtml; // 最后还原页面
	    }
	</script>
</html>
